package com.guojizhuang.writable;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class TransactionRecordWritable implements Writable {
    private Long use_ID;
    private Long mer_ID;
    private Long loc_ID;
    private String time;

    public TransactionRecordWritable()
    {
    }

    public TransactionRecordWritable(Long use_ID, Long mer_ID, Long loc_ID, String time)
    {
        this.use_ID = use_ID;
        this.mer_ID = mer_ID;
        this.loc_ID = loc_ID;
        this.time = time;
    }

    public void setUse_ID(Long use_ID)
    {
        this.use_ID = use_ID;
    }

    public Long getUse_ID() {
        return use_ID;
    }

    public Long getMer_ID() {
        return mer_ID;
    }

    public void setMer_ID(Long mer_ID) {
        this.mer_ID = mer_ID;
    }

    public Long getLoc_ID() {
        return loc_ID;
    }

    public void setLoc_ID(Long loc_ID) {
        this.loc_ID = loc_ID;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }
    public void write(DataOutput dataOutput) throws IOException
    {
        dataOutput.writeLong(use_ID);
        dataOutput.writeLong(mer_ID);
        dataOutput.writeLong(loc_ID);
        dataOutput.writeUTF(time);
    }
    public void readFields(DataInput dataInput) throws IOException
    {
        use_ID = dataInput.readLong();
        mer_ID = dataInput.readLong();
        loc_ID = dataInput.readLong();
        time = dataInput.readUTF();
    }

    @Override
    public String toString() {
        return "TransactionRecordWritable{" +
                "use_ID=" + use_ID +
                ", mer_ID=" + mer_ID +
                ", loc_ID=" + loc_ID +
                ", time='" + time + '\'' +
                '}';
    }
}
